package yz.zookeeper;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;

public class zookeeperDemo6 {
    public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
        ZooKeeper zooKeeper = new ZooKeeper("master:2181,node1:2181,node2:2181", 15000, new Watcher() {
            //对于接口对象创建时，要实现抽象函数
            @Override
            public void process(WatchedEvent watchedEvent) {
                System.out.println("连接正在连接。。。连接成功");
            }
        });
        zooKeeper.delete("/api",-1);  //表示最新版本
        //删除一个为空的节点，没有deleteAll这个函数

        zooKeeper.close();

    }
}
